﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Math;

namespace Fibonacci
{
  class Program
  {
    static void Main(string[] args)
    {
      ulong number;
      Console.Write("Enter which number of the Fibonacci's order you want to compute: ");
      number = ulong.Parse( Console.ReadLine());
      Console.WriteLine("\nThe result is: {0}", Fib(number));
      Console.ReadLine();
    }
    class Fib
    {
      Dictionary<ulong, ulong> dynamicFib;
      int number;
      ulong result;
      Fib()
      {
        this.dynamicFib = new Dictionary<ulong, ulong>();
        this.number = 0;
        this.result = 0;
      }
      public ulong returnFib(int question)
      {
        Fib(question);
        return result;
      }
      private void Fib(int number)
      {
        ulong result;
        if (number == 1 || number == 2)
        {
          return 1;
        }
        else
        {
          result = Fib(number - 1) + Fib(number - 2);
          dynamicFib.Add(number, result);
          return result;
        }
      }
    }
    //static ulong Fib(ulong order)
    //{
    //  Dictionary<ulong, ulong> dynamicFib = new Dictionary<ulong, ulong>();
    //  ulong result;
    //  if (order == 1 || order == 2)
    //  {
    //    Console.Write(".");
    //    return 1;
        
    //  }
    //  else
    //  {
    //    result = Fib(order - 1) + Fib(order - 2);
    //    dynamicFib.Add(order, result);
    //    return result;
    //  }
    //}
  }
}
